using UnityEngine;
using System.Collections;

public class InstantiatePlatform : MonoBehaviour {

	public GameObject lastPlatform;
	public GameObject newPlatform = null;
	public GameObject platform;
	public int numMaxPlaforms = 5;
	public static int numPlatforms = 0;
	
	// Use this for initialization
	void Start ()
	{
		numPlatforms = 0;	
	}
	
	// Update is called once per frame
	void Update () 
	{
		if(numPlatforms <numMaxPlaforms)
		{
			newPlatform = (GameObject)Instantiate(platform, new Vector3(lastPlatform.transform.position.x + 3.8f, lastPlatform.transform.position.y, lastPlatform.transform.position.z),Quaternion.identity);
			lastPlatform = newPlatform;
			numPlatforms++;
		}
	}
}
